using System.Collections.Generic;
using Engine;
using Engine.OldSerialization;

namespace RuthlessConquest {
    public class TickMessage : Message {
        public class Serializer : ISerializer<TickMessage> {
            public void Serialize(InputArchive archive, ref TickMessage value) {
                archive.Serialize("Tick", ref value.Tick);
                archive.Serialize("IsGameStarted", ref value.IsGameStarted);
                archive.Serialize("OrdersByFaction", ref value.OrdersByFaction);
                archive.Serialize("PlayerDescriptions", ref value.PlayerDescriptions);
            }

            public void Serialize(OutputArchive archive, TickMessage value) {
                archive.Serialize("Tick", value.Tick);
                archive.Serialize("IsGameStarted", value.IsGameStarted);
                archive.Serialize("OrdersByFaction", value.OrdersByFaction);
                archive.Serialize("PlayerDescriptions", value.PlayerDescriptions);
            }
        }

        public int Tick;

        public bool IsGameStarted;

        public SortedDictionary<Faction, DynamicArray<Order>> OrdersByFaction = new();

        public DynamicArray<PlayerDescription> PlayerDescriptions = new();
    }
}